<!--{template lyear:header_simple_start}-->
<!--{template lyear:header_simple_end}-->
<main class="bs-main-container">
	<div class="container-fluid">
	  <div class="card">
		<div class="card-body">
			<ul class="nav nav-pills">
				<li class="nav-item">
					<a class="nav-link <!--{if $group=='0' && !$org}-->active<!--{/if}-->" href="{MOD_URL}&op=default&group=0">{lang universal_application}</a>
				</li>
				<li class="nav-item">
					<a class="nav-link <!--{if $group=='-1' && !$org}-->active<!--{/if}-->" href="{MOD_URL}&op=default&group=-1">{lang tourist_application}</a>
				</li>
	
				<li class="nav-item">
					<a class="nav-link <!--{if $group=='1'}-->active<!--{/if}-->" href="{MOD_URL}&op=default&group=1">{lang rank_file_application}</a>
				</li>
				<li class="nav-item">
					<a class="nav-link <!--{if $group=='3' && !$org}-->active<!--{/if}-->" href="{MOD_URL}&op=default&group=3">{lang system_administrator_application}</a>
				</li>
				<li class="nav-item">
					<a class="nav-link <!--{if $group=='2' && !$org}-->active<!--{/if}-->" href="{MOD_URL}&op=default&group=2">{lang section_administrator_application}</a>
				</li>
			</ul>
		</div>
	</div>
	<div class="card">
		<div class="card-body">
			<form id="appform" name="appform" class="form-horizontal" action="{MOD_URL}&op=default" method="post">
				<input type="hidden" name="appsubmit" value="true" />
				<input type="hidden" name="formhash" value="{FORMHASH}" />
				<div class="table-responsive">
					<table class="table table-hover align-middle">
						<thead>
							<th style="min-width: 40px">{lang sort}</th>
							<th style="min-width: 120px">{lang application_name}</th>
							<th style="min-width: 120px">{lang default_location}</th>
							<!--{if $group==1}--><th style="min-width: 180px">{lang allow_department}<small style="display:block;font-size:12px;">{lang allow_department_tip}</small></th><!--{/if}-->
							<th style="min-width: 120px">{lang force_installed}<small style="display:block;font-size:12px;">{lang force_installed_tip}</small></th>
							<th style="min-width: 120px">{lang clear}<small style="display:block;font-size:12px;">{lang clear_application_install}</small></th>
						</thead>
						<!--{loop $list $value}-->
						<tr>
							<td><input type="text" class="form-control" name="disp[{$value[appid]}]" value="$value[disp]" style="width: 60px;" /></td>
							<td><a href="$value[appurl]" class="dcolor"><img src="$value[appico]" />$value[appname]</a></td>
							<td>
								<select name="position[{$value[appid]}]" class="form-select">
									<!--{loop $positionarr $key $value1}-->
									<option value="$key" <!--{if $value[position]==$key}-->selected="selected"<!--{/if}-->>$value1</option>
									<!--{/loop}-->
								</select>
							</td>
							<!--{if $group==1}-->
							<td>
								<!--{loop $value[orgs] $value1}-->
								<span class=" btn-sorg">
									{eval echo avatar_group($value1['orgid']);} 
								</span>
								<!--{/loop}-->
								
							</td>
							<!--{/if}-->
							<td>
								<div class="form-check form-switch">
									<input type="checkbox" class="form-check-input" name="notdelete[{$value[appid]}]" value="1" <!--{if $value[notdelete]>0}-->checked<!--{/if}--> />
								</div>
							</td>
							<td>
								<button id="clear_{$value['appid']}" class="btn btn-round btn-outline-primary btn-sm" data-loading-text="{lang in_clear}" type="button" title="{lang clear_application_install}" onclick="clearAppFromUser('$value[appid]');return false">{lang clear}</button>
							</td>
						</tr>
						<!--{/loop}-->
					</table>
					<input type="submit" class="btn btn-primary btn-round bodyloading" value="{lang save_set}" />
					$multi
				</div>
			</form>
			<div class="mt-2 alert alert-warning alert-dismissible fade show" role="alert">
				<strong>{lang board_message}</strong> {lang appdefault_board_message_text}
				<button type="button" class="btn-close" data-dismiss="alert" aria-label="Close"></button>
			</div>
		</div>
	</div>
</div>
</main>
<script type="text/javascript">
	var selorg = {};
	function clearAppFromUser(appid, i) {
		if(!i) i = 0;
		var el = jQuery('#clear_' + appid);
		if(i == 0) el.button('loading');
		jQuery.getJSON('{MOD_URL}&op=default&do=clear&appid=' + appid + '&i=' + i, function(json) {
			if(json.error) {
				el.html(json.error);
				window.setTimeout(function() {
					el.html('{lang clear}');
					el.button('reset');
				}, 1000);
			} else if(json.msg == 'continue') {
				clearAppFromUser(appid, json.start);
			} else if(json.msg == 'success') {
				window.setTimeout(function() { el.html('{lang clear_success}'); }, 1000);
				window.setTimeout(function() {
					el.html('{lang clear}');
					el.button('reset');
				}, 2000);
			}
		});
	}
</script>
<!--{template lyear:footer_simple}-->